﻿using AbpVnext_Module.Repository;
using Ebusiness_Domain.Model;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Services;
using AbpVnext_Module.Model;

namespace Ebusiness_Domain.Repository
{
    /// <summary>
    /// 领域服务
    /// </summary>
    [Dependency(ServiceLifetime.Transient)]
    public class PermissiontMannage : IDomainService
    {
        public IPermissionGrantsRepository PermissionGrantsRepository { get; set; }

        public IProductImageRepository ProductImageRepository { get; set; }

        public IPermissionRepository PermissionRepository { get; set; }

        public PermissiontMannage()
        {

        }

        /// <summary>
        /// 
        /// </summary>
        public async Task CreatePerMange(PermissionProduct productImage)
        {
            productImage.PermissionGroup = "xxxxx";
            productImage.PermissionName = "xxxxx";
            await PermissionRepository.InsertAsync(productImage);

            await ProductImageRepository.InsertAsync(new ProductImage() { Url = "111" , ProductId = 123 });

            PermissionGrants permissionGrants = new PermissionGrants() { PermissionName = "xxxx", ProviderName = "www", ProviderKey = "wwww" };
            await PermissionGrantsRepository.InsertAsync(permissionGrants);

            throw new Exception("异常处理");
            //return "xxx";
        }
    }
}
